local rtx = Proto("rtx", "RTP Retransmission");

rtx.prefs.apt = Pref.uint( "apt", 102, "associated payload type")

local f_osn = ProtoField.uint16("rtx.osn", "original sequence number", base.DEC)
rtx.fields = {f_osn}

function rtx.init()
	print("rtx.init")
end

function rtx.prefs_changed()
	print("rtx.prefs_changed")
end

function rtx.dissector(buf, pkt, tree)
	local subtree = tree:add(buf(0, 2), "RTP Retransmission")
	subtree:add(f_osn, buf(0,2))
	
	local dissector = DissectorTable.get("rtp.pt"):get_dissector(rtx.prefs.apt)
	if dissector ~= nil then
		dissector:call(buf(2):tvb(), pkt, tree)
	end
end

local rtp_encap_table = DissectorTable.get("rtp.pt")
rtp_encap_table:add(103, rtx)